#include<iostream>
using namespace std;
class Operation{
public:
    virtual double GetResult()=0;
public:
    double a;
    double b;
};

class AddOperation: public Operation{
public:
    double GetResult() override
    {
        return a + b;
    }
};

class MulOperation: public Operation{
public:
    double GetResult() override
    {
        return a * b;
    }
};
class SimpleFactor{
public:
    static Operation *CreateOperation(string op)
    {
        switch (op[0]) {
            case '+': {
                return new AddOperation();
            }
            case '*': {
                return new MulOperation();
            }
        }
    }
};
int main(int argc, char *argv[])
{
    SimpleFactor sf;
    Operation *op = sf.CreateOperation("+");
    op->a = 2;
    op->b = 3;
    cout << op->GetResult() << endl;
    delete op;

    op = sf.CreateOperation("*");
    op->a = 2;
    op->b = 3;
    cout << op->GetResult() << endl;

}